package com.visitcqut.service.impl;

import com.visitcqut.domain.Campus;
import com.visitcqut.mapper.CampusMapper;
import com.visitcqut.service.CampusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @program: visitcqut
 * @description: 校园服务实现类
 * @author: ATAO
 * @create: 2020-11-14 13:37
 **/



@Repository
public class CampusServiceImpl implements CampusService {

    /**
     * 数据库访问层
     */
    @Autowired
    CampusMapper campusMapper;

    /**
     * 添加校园
     * @param data
     * @return int
     */
    @Override
    public int insert(Campus data) {
        return campusMapper.insert(data);
    }


    /**
     * 删除校园
     * @param id
     * @return int
     */
    @Override
    public int delete(Integer id) {
        return campusMapper.delete(id);
    }


    /**
     * 更新校园信息
     * @param data
     * @return int
     */
    @Override
    public int update(Campus data) {
        return campusMapper.update(data);
    }


    /**
     * 根据ｉｄ查找校园
     * @param id
     * @return Campus
     */
    @Override
    public Campus findById(Integer id) {
        return campusMapper.findById(id);
    }



    /**
     * 查找所有校园
     * @return :list<Campus>
     */
    @Override
    public List<Campus> findAll() {
        return campusMapper.findAll();
    }
}
